dnl
dnl $ Id: $
dnl

PHP_ARG_ENABLE(avahii, whether to enable avahii functions,
[  --enable-avahii         Enable avahii support])

if test "$PHP_AVAHII" != "no"; then

PHP_ARG_WITH(avahi, whether avahi is available,[  --with-avahi[=DIR]   With avahi support])



  export OLD_CPPFLAGS="$CPPFLAGS"
  export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_AVAHI"
  PHP_SUBST(AVAHII_SHARED_LIBADD)

  PHP_ADD_LIBRARY_WITH_PATH(avahi-common, $PHP_AVAHI_DIR/lib, AVAHII_SHARED_LIBADD)
  PHP_ADD_LIBRARY_WITH_PATH(avahi-client, $PHP_AVAHI_DIR/lib, AVAHII_SHARED_LIBADD)
  export CPPFLAGS="$OLD_CPPFLAGS"

  export OLD_CPPFLAGS="$CPPFLAGS"
  export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_AVAHII"

  AC_MSG_CHECKING(PHP version)
  AC_TRY_COMPILE([#include <php_version.h>], [
#if PHP_VERSION_ID < 50000
#error  this extension requires at least PHP version 5.0.0
#endif
],
[AC_MSG_RESULT(ok)],
[AC_MSG_ERROR([need at least PHP 5.0.0])])

  export CPPFLAGS="$OLD_CPPFLAGS"


  PHP_SUBST(AVAHII_SHARED_LIBADD)
  AC_DEFINE(HAVE_AVAHII, 1, [ ])

  PHP_NEW_EXTENSION(avahii, avahii.c , $ext_shared)

fi

